<%@page import="beans.Usuario"%>
<%@page import="java.util.List"%>

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://displaytag.sf.net/el" prefix="tb"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Lista de Usuarios</title>
<script type="text/javascript">
	function abrirpopupEdit() {
		document.getElementById("btnPerfil").disabled = false;
		$("#dgEditar").dialog("open");
	}
	function abrirpopupElim() {

		$("#dgMsgEliminar").dialog("open");

	}
</script>

<script>
	document.getElementById("tbUsuario").onclick = function(e) {
		if (!e)
			e = window.event;
		if (!e.target)
			e.target = e.srcElement;
		var TR = e.target;
		while (TR.nodeType == 1 && TR.tagName.toUpperCase() != "TR")
			TR = TR.parentNode;
		var celdas = TR.getElementsByTagName("TD");
		if (celdas.length != 0)
			document.getElementById('txtCodigo').value = celdas[0].innerHTML;
		document.getElementById('txtNombre').value = celdas[1].innerHTML;
		document.getElementById('txtApePater').value = celdas[2].innerHTML;
		document.getElementById('txtApeMater').value = celdas[3].innerHTML;
		document.getElementById('txtFecNac').value = celdas[4].innerHTML;
		document.getElementById('txtDireccion').value = celdas[5].innerHTML;
		document.getElementById('txtCorreo').value = celdas[6].innerHTML;
		document.getElementById('txtTelefono').value = celdas[7].innerHTML;
		document.getElementById('cboDistrito').selectedIndex = celdas[9].innerHTML;
		document.getElementById('txtuseru').value = celdas[10].innerHTML;
		document.getElementById('txtpassu').value = celdas[11].innerHTML;

	}
</script>

</head>
<body>

	<tb:table id="tbUsuario"
		name='<%=session.getAttribute("listaUsuarios")%>'>
		<tb:column class="fila" property="codigo" title="Codigo" />
		<tb:column class="fila" property="nombres" title="Nombres" />
		<tb:column class="fila" property="apepa" title="Apellido Paterno" />
		<tb:column class="fila" property="apema" title="Apellido Materno" />
		<tb:column class="fila" property="fecna" title="Fecha de Nacimiento" />
		<tb:column class="fila" property="direccion" title="Direccion" />
		<tb:column class="fila" property="correo" title="Correo" />
		<tb:column class="fila" property="telefono" title="Telefono" />
		<tb:column class="acciones" title="Acciones">
			<input type="button" id="btnEditar" onclick="abrirpopupEdit();"/>
			<input type="button" id="btnEliminar" ondblclick="eliminarUsuario();abrirpopupElim();">
		</tb:column>

		<tb:column style="display: none;" title="" property="distrito" />
		<tb:column style="display: none;" title="" property="user" />
		<tb:column style="display: none;" title="" property="pass" />
	</tb:table>

</body>
</html>